<!-- 名片审批管理 -->
<template>
  <div class="commission">
    <dt-search ref="search" :labelWidth="labelWidth" />
    <dt-grid ref="table" page :onFetch="onFetch" />
    <process-modal ref="process" />
  </div>
</template>

<script>
  import Column from './opt/column.js'
  import searchOpt from './opt/search.js'
  import auditMgr from '@/biz/flowApproval/processAudit.js'
  import processModal from '@/components/biz/audit/process-modal.vue'
  export default {
    components: {
      processModal
    },
    data() {
      return {
        columns: [],
        labelWidth: 80
      }
    },
    mounted() {
      this.$refs.table.init(this, new Column(this))
      this.$refs.table.init(this)
      this.$refs.search.init(this.$refs.table, searchOpt.options(this))
      this.$refs.table.fetch()
    },
    methods: {
      onFetch(data) {
        return auditMgr
          .list({
            ...data,
            auditType: 8,
            buttonType: -1
          })
          .then((res) => {
            res &&
              res.list.forEach((item) => {
                item = Object.assign(item, item.auditData)
              })
            return res
          })
      },
      processFun(data) {
        this.$refs.process.show({
          ...data,
          auditType: 8
        })
      }
    }
  }
</script>

<style lang="scss" scoped>
  .commission {
    padding: 20px;
  }
</style>
